<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>备忘录模式</title>
		<script src="https://code.jquery.com/jquery-1.10.2.js"></script>

	</head>

	<body>
		<script type="text/javascript">
			var Page = function() {
				var page = 1,
					cache = {},
					test="xxxx",
					data;
				return function(page) {
					debugger
					console.info(test);
					if(cache[page]) {
						data = cache[page];
						console.info("缓存：" + data)
						return data
					} else {
						$.getJSON('promise/stu.json', function(data) {
							cache[page] = data;
							console.info("请求：" + data)
							return data
						})
					}
				}
			}()
			Page(1)
		</script>
	</body>

</html>